package twodimension;

public class DynamicInitDemo {

    public static void main(String[] args) {

        int[][] arr = new int[3][3];

        int iCount = 1;
        //动态初始化
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                arr[i][j] = iCount;
                iCount++;
            }
        }

        //遍历二维数组
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }
}
